package com.teradata.callback;

public class Student implements DoHomeWork {

    public void doHomeWork(String question, String answer) {
        System.out.println("作业本");
        if(answer != null) {
            System.out.println("作业："+question+" 答案："+ answer);
        } else {
            System.out.println("作业："+question+" 答案："+ "(空白)");
        }
    }

    public void ask(final String homework, final RoomMate roomMate) {
        new Thread(new Runnable() {
        public void run() {
                roomMate.getAnswer(homework, Student.this);
            }
        }).start();
        goHome();
    }

    public void goHome(){
        System.out.println("我回家了……好室友，帮我写下作业。");
    }
}
